#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <cmath>
#include <iterator>
#define ll long long

using namespace std;

int main(){
	
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int t;
	cin >> t;
	while(t--){
		int n;
		cin >> n;
		unordered_map<ll,int> mp;
		for(int j = 0; j < n; ++j){
			ll num;
			cin >> num;
			++mp[num];
		}
		bool f = true;
		for(auto it1 = mp.begin(); it1 != mp.end(); ++it1){
			ll keyi = it1->first;
			int val = it1->second;
			if(val >= 2){
				if((keyi ^ keyi)< keyi){
					cout << "NO";
					f = false;
					break;
				}
			}
			for(auto it2 = next(it1); it2 != mp.end(); ++it2){
				ll keyj = it2->first;
				if((keyi ^ keyj) <= max(keyi,keyj)){
					cout << "NO";
					f = false;
					break;
				}
			}
			if(!f) break;
		}
		if(f) cout << "YES";
		if(t) cout << endl;
	}
	
	return 0;
}

